from rest_framework.filters import BaseFilterBackend


class PreDepositLogAllowPermissionFilterBackend(BaseFilterBackend):
    def filter_queryset(self, request, queryset, view):
        user = request.user
        model_cls = queryset.model
        has_all_school_permission = False
        if user.is_superuser:
            has_all_school_permission = True

        if has_all_school_permission:
            return queryset
        else:
            print(request.user.id)
            queryset = queryset.filter(id=request.user.id)
            return queryset
